package com.tjshop.android.model;

import java.util.ArrayList;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

import com.tjshop.android.model.tj.json.Goods;

/**
 * Created by gytaiSSD on 2015/1/6.
 */
public class GoodsFullDetails extends BaseObject{
	private int cat_id;//"cat_id":3,
    private String name;//"name":"板蓝根颗粒",
    private String style;//"goods_name_style":"+",
    private int click_count;//"click_count":208,
    private int goods_number;//"goods_number":20,
    private int market_price;//"market_price":24,
    private int shop_price;//"shop_price":12,
    private int  promote_price;//"promote_price":0,
    private String keywords;//"keywords":"",
    private String goods_brief;//"goods_brief":"",
    private int xl;//"xl":"",
    private String twDetail ;
    private List<String> xc = new ArrayList<String>();
    private List<Comment> pl = new ArrayList<Comment>();
    
    private List<Goods> gl = new ArrayList<Goods>();
    
    

    public List<Goods> getGl() {
		return gl;
	}

	public void setGl(List<Goods> gl) {
		this.gl = gl;
	}

	public List<Comment> getPl() {
		return pl;
	}

	public void setPl(List<Comment> pl) {
		this.pl = pl;
	}


	public String getTwDetail() {
		return twDetail;
	}

	public void setTwDetail(String twDetail) {
		this.twDetail = twDetail;
	}

	public List<String> getXc() {
		return xc;
	}

	public void setXc(List<String> xc) {
		this.xc = xc;
	}

	public int getCat_id() {
		return cat_id;
	}

	public void setCat_id(int cat_id) {
		this.cat_id = cat_id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public String getStyle() {
		return style;
	}

	public void setStyle(String style) {
		this.style = style;
	}

	public int getClick_count() {
		return click_count;
	}

	public void setClick_count(int click_count) {
		this.click_count = click_count;
	}

	public int getGoods_number() {
		return goods_number;
	}

	public void setGoods_number(int goods_number) {
		this.goods_number = goods_number;
	}

	public int getMarket_price() {
		return market_price;
	}

	public void setMarket_price(int market_price) {
		this.market_price = market_price;
	}

	public int getShop_price() {
		return shop_price;
	}

	public void setShop_price(int shop_price) {
		this.shop_price = shop_price;
	}

	public int getPromote_price() {
		return promote_price;
	}

	public void setPromote_price(int promote_price) {
		this.promote_price = promote_price;
	}

	public String getKeywords() {
		return keywords;
	}

	public void setKeywords(String keywords) {
		this.keywords = keywords;
	}

	public String getGoods_brief() {
		return goods_brief;
	}

	public void setGoods_brief(String goods_brief) {
		this.goods_brief = goods_brief;
	}

	public int getXl() {
		return xl;
	}

	public void setXl(int xl) {
		this.xl = xl;
	}

	public void parse(JSONObject obj) {
		setCat_id(getInt(obj, "cat_id"));
		setClick_count(getInt(obj, "click_count"));
		setGoods_brief(getString(obj, "goods_brief"));
		setGoods_number(getInt(obj, "goods_number"));
		setKeywords(getString(obj, "keywords"));
		setMarket_price(getInt(obj, "market_price"));
		setName(getString(obj, "name"));
		setPromote_price(getInt(obj, "promote_price"));
		setShop_price(getInt(obj, "shop_price"));
		setStyle(getString(obj, "goods_name_style"));
		setXl(getInt(obj, "xl"));
		setTwDetail(getString(obj, "tw"));
		
		JSONArray array;
		try {
			array = obj.getJSONArray("xc");
			for (int i = 0; i < array.length(); i++) {
				JSONObject o = array.getJSONObject(i);
				xc.add("http://"+o.getString("fileurl"));
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		try {
			array = obj.getJSONArray("pl");
			for (int i = 0; i < array.length(); i++) {
				Comment c = new Comment();
				c.parse(array.getJSONObject(i));
				pl.add(c);
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		try {
			array = obj.getJSONArray("gl");
			for (int i = 0; i < array.length(); i++) {
				Goods c = new Goods();
				c.parse(array.getJSONObject(i));
				gl.add(c);
			}
		} catch (JSONException e) {
			e.printStackTrace();
		}
		
		
	}



	@Override
	public void parse(JSONArray data) {
		
	}

}
